package book;

public class BookList {
    //定义书架
    //将书存在书架中
    private Book[] books=new Book[10];//存10本书
    private int usedSize;//记录书的数量

    public BookList() {
        //初始化一开始的书
        this.books[0]=new Book("三国演义","罗贯中",18,"小说");
        this.books[1]=new Book("西游记","吴承恩",8,"小说");
        this.books[2]=new Book("红楼梦","曹雪芹",12,"小说");
        this.usedSize=3;
    }

    public int getUsedSize() {
        return usedSize;
    }

    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }
    //重写方法，获取数组中的一本书
    public Book getBook(int pos) {
        return books[pos];
    }
    //放置新的书
    public void setBook(int pos,Book book) {
        this.books[pos]=book;
    }
    //获取整个数组
    public Book[] getBooks() {
        return books;
    }
}
